import axios from "@/utils/axios";

// 获取员工列表
export const getEmployeeList = (params?: any): Promise<any> =>
    axios.get("/api/employees", { params });

// 获取员工详情
export const getEmployeeById = (id: number): Promise<any> =>
    axios.get(`/api/employees/${id}`);

// 创建员工
export const createEmployee = (data: any): Promise<any> =>
    axios.post("/api/employees", data);

// 更新员工
export const updateEmployee = (id: number, data: any): Promise<any> =>
    axios.put(`/api/employees/${id}`, data);

// 删除员工
export const deleteEmployee = (id: number): Promise<any> =>
    axios.delete(`/api/employees/${id}`);

// 获取考勤信息列表
export const getClockingList = (params?: any): Promise<any> =>
    axios.get("/api/clockings", { params });

// 获取应聘者列表
export const getApplicantList = (params?: any): Promise<any> =>
    axios.get("/api/applicants", { params });

// 获取最近生日人员
export const getBirthdayList = (): Promise<any> =>
    axios.get("/api/employees/birthdays");

// 获取合同到期人员
export const getContractExpiringList = (): Promise<any> =>
    axios.get("/api/employees/contract-expiring");

// 获取试用期到期人员
export const getProbationExpiringList = (): Promise<any> =>
    axios.get("/api/employees/probation-expiring");

// 获取性别统计信息
export const getGenderStatistics = (): Promise<any> =>
    axios.get("/api/statistics/gender");

// 获取学历统计信息
export const getEducationStatistics = (): Promise<any> =>
    axios.get("/api/statistics/education");

// 文件下载
export const exportGoods = (data?: any) =>
    axios.post("/api/export", data, { responseType: "blob" });

// 用户登录
export const login = (data: { username: string; password: string }): Promise<any> =>
    axios.post("/api/auth/login", data);

// 获取用户信息
export const getUserInfo = (): Promise<any> =>
    axios.get("/api/auth/info");

// 用户登出
export const logout = (): Promise<any> =>
    axios.post("/api/auth/logout");
